<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
</head>
<body>
<form action="/user/login" method="post">
    账号：<input type="text" name="username"/> <br/>
    密码：<input type="password" name="password"> <br/>
    <input type="hidden" name="_csrf" th:value="${_csrf.token}"/>
    验证码：<input type="text" name="captcha"/>
    <img id="captchaCode" th:src="@{ '/common/captcha' }" style="cursor:pointer;" title="看不清？换一张" onclick="reImg()"/>
    <span th:text="${session?.errorMsg}" style="color: #FF0000;"></span>
    <br/>
    <button type="submit">登 录</button>
</form>

<script th:inline="javascript">
    function reImg() {
        var img = document.getElementById("captchaCode");
        img.src = "/common/captcha?random=" + Math.random();
    }
</script>
</body>
</html>